//
//  PublicMessageDataBase.h
//  AAIM
//
//  Created by 远的小布丁 on 2020/1/23.
//  Copyright © 2020 AAIM. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ChildMenusModel.h"
NS_ASSUME_NONNULL_BEGIN

@interface PublicMessageDataBase : NSObject
+ (instancetype)sharePublicMessageDataBase;

- (void)creatPublicTable;

// 插入数据
- (void)insertMessage:(ChildMenusModel *)msg;

// 清空记录
- (void)clearAllMessageWithPublicUdid:(NSString *)publicUdid;

// 清空所有公众号的聊天记录
- (void)clearAllMessageWithAllPublic;

// 根据uid查询所有聊天记录
- (NSArray<ChildMenusModel *> *)queryAllMessagesWithPublicUdid:(NSString *)publicUdid;
// 分页加载，每页20条
- (NSArray *)queryMessagesWithPublicId:(NSInteger)publicId toTimestamp:(long long) toTimestamp;

// 加载最新的count条数据
- (NSArray *)queryMessagesWithPublicId:(NSInteger)publicId count:(NSInteger)count;
// 根据publicID和内容模糊搜索
- (NSArray<ChildMenusModel *> *)queryMessagesWithpublicID:(NSInteger )publicID byContent:(NSString *)content;
@end

NS_ASSUME_NONNULL_END
